from redis import StrictRedis

class Config:
    DEBUG = None
    #设置秘钥
    SECRET_KEY = '777'
    #连接数据库
    SQLALCHEMY_DATABASE_URI = 'mysql://root:mysql@localhost/test2'
    #设置状态追踪
    SQLALCHEMY_TRACK_MODIFICATIONS = False
    #配置redis信息实现状态保持 存储用户的session和信息
    #定义redis 的主机和端口
    REDIS_HOST = '127.0.0.1'
    REDIS_PORT = 6379
    SESSION_KET = 'redis'
    SESSION_REDIS = StrictRedis(host=REDIS_HOST,port=REDIS_PORT)
    #签名
    SESSION_USE_SIGNER = True
    #配置session过期时间
    PERMANENT_SESSION_LIFETIME = 86400




class developmentConfig(Config):
    DEBUG = True

class productionConfig(Config):
    DEBUG = False

 #定义字典
config = {
    'development':developmentConfig,
    'production':productionConfig
}

